﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Odbc;
using System.Collections;

namespace LI4SilverWCF.data
{
    class DBLogfile
    {
        OdbcConnection con;
        public DBLogfile(OdbcConnection c)
        {
            con = c;
        }

        public Hashtable obterRegistos()
        {
            Hashtable logs = new Hashtable();
            ArrayList log;

            string query = "SELECT COD_LOG, COD_CLIENTE, DATA, DESCRICAO FROM LOGFILE";
            OdbcCommand command = new OdbcCommand(query, con);
            con.Open();
            OdbcDataReader reader = command.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    log = new ArrayList();
                    log.Add(reader.GetInt32(1));
                    log.Add(reader.GetDateTime(2));
                    log.Add(reader.GetString(3));
                    logs.Add(reader.GetInt32(0), log);
                }
            }
            catch (Exception e)
            {
            }
            con.Close();
            return logs;
        }

    }
}